package mdt.gui;

import org.tigris.gef.base.Globals;
import org.tigris.gef.presentation.Fig;

import javax.swing.*;
import java.awt.*;

/**
 * Created by xiaobyu on 7/19/2016.
 */
public class AttributePanel extends JPanel {


    protected Fig firstFig;
    protected java.util.List<Fig> figs;
    static final Color LABEL_COLOR = new Color(0, 70, 213);

    public AttributePanel() {
        figs = Globals.curEditor().getSelectionManager().getSelectedFigs();
        firstFig = figs.get(0);

        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

        initLayout();
        addHeadComponent();
    }

    protected void initLayout() {

    }

    protected void addHeadComponent() {
        if (figs.size() > 1) {
            JLabel warning = new JLabel("<html><font color='red'>Note: </font>More than one figure is selected, " +
                    "the change will apply to all selected figures.</html>");
            add(warning, "span, growx, gapbottom 15, wrap");
        }
    }

    protected void addSeparator(String text) {

        JLabel label = new JLabel(text, 10);
        label.setForeground(LABEL_COLOR);

        add(label, "gapbottom 1, span, split 2, aligny center");
        add(new JSeparator(), "gapleft rel, growx");
    }
}
